package cn.web.auction.controller;

import java.util.List;
//import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.web.auction.util.Result;
//import net.sf.json.JSONObject;
import net.sf.json.JSONArray;
import cn.web.auction.pojo.Partner;
import cn.web.auction.service.PartnerService;


@Controller
public class PartnerController {
	
	@Autowired
	private PartnerService partnerService;
	
	//查询伙伴的全部数据
	@CrossOrigin
	@ResponseBody
	@RequestMapping("/queryPartner")
	public Object queryPartner() {
		List<Partner> list = partnerService.findPartner();
		JSONArray jsonstr = JSONArray.fromObject(list);
		System.out.print(jsonstr);
		return Result.success(jsonstr);
		
	}
	
	//修改自己的信息
	@CrossOrigin
	@ResponseBody
	@RequestMapping("/updatePartner")
	public Object updatePartner(Partner partner) {
		partnerService.updatePartner(partner);
		System.out.println("12"+partner);
		JSONArray jsonstr = JSONArray.fromObject(partner);
		return Result.success(jsonstr);
	}
	
	

}
